import requests
import threading

target_url = "http://localhost:5000/api/devices"  # 后端接口地址

def attack():
    while True:
        requests.post(target_url, json={"features": [0.1, 0.2, 0.3, 0.4, 0.5]})

# 启动50个线程模拟并发攻击
for _ in range(50):
    threading.Thread(target=attack).start()